package com.jie.langlangmall.portal.repository;

import com.jie.langlangmall.portal.domain.MemberBrandAttention;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;

/**
 * @Author Jie
 * @Date 2024/11/27
 * @Email 3217998214@qq.com
 * @Description 会员品牌关注Repository
 */
public interface MemberBrandAttentionRepository extends MongoRepository<MemberBrandAttention, String> {

    /**
     * 根据会员ID和品牌ID查找记录
     *
     * @param memberId
     * @param brandId
     * @return
     */
    MemberBrandAttention findByMemberIdAndBrandId(Long memberId, Long brandId);

    /**
     * 根据会员ID和品牌ID删除记录
     *
     * @param memberId
     * @param brandId
     * @return
     */
    void deleteByMemberIdAndBrandId(Long memberId, Long brandId);

    /**
     * 根据会员ID分页查找记录
     *
     * @param memberId
     * @param pageable
     * @return
     */
    Page<MemberBrandAttention> findByMemberId(Long memberId, Pageable pageable);

    /**
     * 根据会员ID删除记录
     *
     * @param memberId
     */
    void deleteAllByMemberId(Long memberId);

}
